package cn.wolfcode.luowowo.mgrsite.listener;

import cn.wolfcode.luowowo.service.IStrateryStatisRedisService;
import cn.wolfcode.luowowo.service.ITravelStatisRedisService;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;


/**
 * 监听器 初始化redis数据
 */
@Component
public class RedisDataInitListener implements ApplicationListener<ContextRefreshedEvent> {

    @Reference
    private IStrateryStatisRedisService strateryStatisRedisService;
    @Reference
    private ITravelStatisRedisService travelStatisRedisService;

    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        strateryStatisRedisService.initRedisStatis();
        travelStatisRedisService.initRedisStatis();
        System.out.println("初始化攻略游记统计成功----------------------------------------");


        strateryStatisRedisService.initRedisCommend();
        System.out.println("初始化攻略推荐统计成功----------------------------------------");

    }
}
